﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Cat.Helper;

using System.IO;

namespace PicServer
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            initdata();
        }

        private void initdata()
        {
            if (new List_helper().get_text_value(Static_value.savepath, "savepath.txt").Count > 0) {
                Static_value.savepath = new List_helper().get_text_value(Static_value.Konach_path, "savepath.txt")[0].ToString();
                label1.Text = Static_value.savepath;
            }
        
        }

        private void button1_Click(object sender, EventArgs e)
        {
            new Konachan.Start().Scanner();
            label1.Text = string.Format("当前保存压缩文件路径：{0}", Static_value.savepath);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("explorer.exe", System.AppDomain.CurrentDomain.BaseDirectory);
        }

        private void button3_Click(object sender, EventArgs e)
        {//Static_value.savepath+"\\" + DateTime.Now.ToString("yyyyMMdd") + @".zip"
            new Yande.yande_pool_download().List_scanner();
          
        }

     

        private void button5_Click(object sender, EventArgs e)
        {
            new Konachan.Konacha_zip().add_zip();
        }

        private void button6_Click(object sender, EventArgs e)
        {
            new Bcy.Bcy_start().scanner_start();
        }

        private void button7_Click(object sender, EventArgs e)
        {
            new Yande.Yande_day_download().yande_list_scanner();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
            dialog.Description = "请选择图片所在文件夹";
            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Console.WriteLine(Static_value.Konach_path + "savepath.txt");
                Console.WriteLine(dialog.SelectedPath);
                File.WriteAllText(Static_value.Konach_path + "savepath.txt", dialog.SelectedPath);
                Static_value.savepath = dialog.SelectedPath;
                label1.Text = string.Format("当前保存压缩文件路径：{0}", Static_value.savepath);
            }
        }
    }
}
